<?php
	$dream_cate = isset($_POST['dream_cate']) ? $_POST['dream_cate'] : '0';
	$page     = isset($_POST['page']) ? $_POST['page'] : '1';
	$name1    = isset($_POST['name1']) ? $_POST['name1'] : '';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="Cache-Control" content="No-Cache">
	<meta http-equiv="Pragma" content="No-Cache">

	<title>운세의신</title>
    
    <link rel="stylesheet" type="text/css" href="/css/common.css">
    <link rel="stylesheet" type="text/css" href="/css/sub.css">
	<link rel="stylesheet" type="text/css" href="/css/free.css">

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			
			var cateIdx = parseInt($("#dream_cate").val(),10);
			var catePad = parseInt($("#dream_cate").val(),10) + 1;
			catePad = catePad < 10 ? '0'+catePad : catePad;
			
			// 탭메뉴
			var btn = $(".dream1_tab ul li a");
			var list = $(".dream1_cont");
			list,btn.each(function(index){
				$(this).click(function(){
					list.hide();
					list.eq(index).show();

					btn.each(function(index){
						$(this).removeClass("on"+(index+1));
					});
					btn.eq(index).addClass("on"+(index+1));
					
					$("#dream_cate").val(index);

				});
			});
			btn.eq(cateIdx).removeClass().addClass("tab"+catePad+" on"+(cateIdx+1));
			list.hide();
			list.eq(cateIdx).show();
			
			// 결과 내용 숨김
			$(".result").hide();

			// 결과 제목 클릭 시 내용 보이기
			$(".result_title").each(function(index) {
				$(this).click(function() {
					$(".result").hide();
					$(".result").eq(index).show();
					$(".result_title").removeClass("on");
					$(this).addClass("on");
				});
			});

			// 검색어 링크 설정
			$(".dream1_cont ul li a").click(function() {
				search($(this).text(), '1', $("#dream_cate").val());
			});

			var msg = '검색어를 입력하세요.';
			if ($("#name1").val() == '') {
				$("#name1").val(msg);
			}
			$("#name1").bind({
				focus: function() {
					if( $(this).val() == msg ) {
						$(this).val('');
					}
				},
				blur: function() {
					if( $(this).val() == '') {
						$(this).val(msg);
					}
				}
			});
			
			$("#frm_search").submit(function(){
				var keyword = $("#name1").val();
				if (keyword == '' || keyword == msg) {
					alert("검색어를 입력하세요.");
					$("#name1").focus();
					return false;
				}
			});
			
			$("#recomm_key li a").click(function() {
				search($(this).text(), 1, 0);
			});
		});
		
		function search(keyword, page, dream_cate) {
			$("#frm_search #dream_cate").val(dream_cate);
			$("#frm_search #page").val(page);
			$("#frm_search #name1").val(keyword);
			$("#frm_search").submit();
		}
		
		function goPage(page) {
			$("#frm_search #page").val(page);
			$("#frm_search").submit();
		}
	</script>
</head>
<body>
<div id="wrap">
<!-- Header -->
	<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/main_header.php'; ?>
	<!--// Header -->
    
    <!--커튼 데코레이션-->
	<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/drape.php'; ?>
	<!--//커튼 데코레이션-->
    
    <!--컨텐츠-->
	<div id="content">
		<!--휘장-->
		<div class="keybox1"> </div>
		<!--//휘장-->

		<p class="key_visual"><img src="/images/sub/free/free_visual.png" alt="무료운세" /></p>	
		
		<!--왼쪽컨텐츠-->
		<div class="assistant">
			<!--왼쪽 메뉴-->
			<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/inc_lnb.php'; ?>
			<!--// 왼쪽 메뉴-->

			<!--추천테마-->
			<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/static/theme2.php'; ?>
			<!--//추천테마-->

			<!--회원가입-->
			<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/static/member_join.php'; ?>
			<!--//회원가입-->

			<!--고객센터-->
			<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/static/cs.php'; ?>
			<!--//고객센터_추가-->
		</div>
		<!--//왼쪽컨텐츠-->

		<!-- 메인컨텐츠-->
		<div class="cont">
        
	 		<!-- Contents -->
			<div class="dream1">
				<h3 class="freetit"><img src="/images/free/free_dream_banner.png" alt="꿈해몽" /></h3>
				<div class="box">
				
                    <!--꿈해몽검색-->
					<div class="search">
						<h4><img src="/images/dream/sstit.png" /></h4>
						<form name="frm_search" id="frm_search" method="post" action="/unse/free/dreamsolve/result">
                        <fieldset>
							<input type="hidden" name="dream_cate" id="dream_cate" value="<?=$dream_cate?>" />
                            <input type="hidden" name="page" id="page" value="<?=$page?>" />
                            <span><input type="text" name="name1" id="name1" value="<?=$name1?>" /></span>
							<button title="검색" type="submit" value="검색" ></button>
							 <!--오토 스타-->
							<ul class="bn_s" id="recomm_key">
								<li><a href="javascript:;">조상</a></li>
								<li>/</li>
								<li><a href="javascript:;">연예인</a></li>
								<li>/</li>
								<li><a href="javascript:;">떡</a></li>
							   	<li>/</li>
								<li><a href="javascript:;">싸움</a></li>
								<li>/</li>
								<li><a href="javascript:;">사랑</a></li>
								<li>/</li>
								<li><a href="javascript:;">죽음</a></li>
							</ul>
							<!--//꿈해몽검색-->
						</fieldset>
                        </form>
                        
                        
                        <!--이전 검색부분
                        <form name="frm_search" id="frm_search" method="post" action="/unse/free/dreamsolve/result">
							<input type="hidden" name="dream_cate" id="dream_cate" value="<?=$dream_cate?>" />
							<input type="hidden" name="page" id="page" value="<?=$page?>" />
							<input type="text" name="name1" id="name1" value="<?=$name1?>" />
							<input type="submit" value="검색" />
						</form>
                        
                      -->
					</div>
					<!--//꿈해몽검색-->

				
				<div class="top">
					<div class="dream1_tab blind">
						<ul>
							<li><a href="javascript:;" class="tab01">사람/인물</a></li>
							<li><a href="javascript:;" class="tab02">신체</a></li>
							<li><a href="javascript:;" class="tab03">행동</a></li>
							<li><a href="javascript:;" class="tab04">생활</a></li>
							<li><a href="javascript:;" class="tab05">음식</a></li>
							<li><a href="javascript:;" class="tab06">동물</a></li>
							<li><a href="javascript:;" class="tab07">식물</a></li>
							<li><a href="javascript:;" class="tab08">자연</a></li>
							<li><a href="javascript:;" class="tab09">질병/죽음</a></li>
							<li><a href="javascript:;" class="tab10">기타</a></li>
						</ul>
					</div><!--dream1_tab-->
					<div class="dream1_cont">
						<ul>
							<li><a href="javascript:;">부모</a></li>
							<li><a href="javascript:;">조상</a></li>
							<li><a href="javascript:;">아기</a></li>
							<li><a href="javascript:;">어린아이</a></li>
							<li><a href="javascript:;">친구</a></li>
							<li><a href="javascript:;">군인</a></li>
							<li><a href="javascript:;">경찰관</a></li>
							<li><a href="javascript:;">연예인</a></li>
							<li><a href="javascript:;">선생님</a></li>
							<li><a href="javascript:;">오빠</a></li>
							<li><a href="javascript:;">할아버지</a></li>
							<li><a href="javascript:;">남편</a></li>
						</ul>
					</div>
					<div class="dream1_cont">
						<ul>
							<li><a href="javascript:;">얼굴</a></li>
							<li><a href="javascript:;">눈</a></li>
							<li><a href="javascript:;">코</a></li>
							<li><a href="javascript:;">입</a></li>
							<li><a href="javascript:;">이</a></li>
							<li><a href="javascript:;">손</a></li>
							<li><a href="javascript:;">다리</a></li>
							<li><a href="javascript:;">성기</a></li>
							<li><a href="javascript:;">엉덩이</a></li>
							<li><a href="javascript:;">머리</a></li>
							<li><a href="javascript:;">머리카락</a></li>
							<li><a href="javascript:;">목</a></li>
							<li><a href="javascript:;">배</a></li>
							<li><a href="javascript:;">등</a></li>
						</ul>
					</div>
					<div class="dream1_cont">
						<ul>
							<li><a href="javascript:;">사랑</a></li>
							<li><a href="javascript:;">싸움</a></li>
							<li><a href="javascript:;">성교</a></li>
							<li><a href="javascript:;">섹스</a></li>
							<li><a href="javascript:;">죽음</a></li>
							<li><a href="javascript:;">시험</a></li>
							<li><a href="javascript:;">키스</a></li>
							<li><a href="javascript:;">임신</a></li>
						</ul>
					</div>
					<div class="dream1_cont">
						<ul>
							<li><a href="javascript:;">비행기</a></li>
							<li><a href="javascript:;">기차</a></li>
							<li><a href="javascript:;">자동차</a></li>
							<li><a href="javascript:;">버스</a></li>
							<li><a href="javascript:;">택시</a></li>
							<li><a href="javascript:;">돈</a></li>
							<li><a href="javascript:;">지폐</a></li>
							<li><a href="javascript:;">동전</a></li>
							<li><a href="javascript:;">신발</a></li>
							<li><a href="javascript:;">침대</a></li>
							<li><a href="javascript:;">의자</a></li>
							<li><a href="javascript:;">책상</a></li>
							<li><a href="javascript:;">책장</a></li>
							<li><a href="javascript:;">책꽂이</a></li>
							<li><a href="javascript:;">이불</a></li>
							<li><a href="javascript:;">베개</a></li>
							<li><a href="javascript:;">보석</a></li>
							<li><a href="javascript:;">장신구</a></li>
							<li><a href="javascript:;">안경</a></li>
							<li><a href="javascript:;">시계</a></li>
						</ul>
					</div>
					<div class="dream1_cont">
						<ul>
							<li><a href="javascript:;">고기</a></li>
							<li><a href="javascript:;">계란</a></li>
							<li><a href="javascript:;">채소</a></li>
							<li><a href="javascript:;">약초</a></li>
							<li><a href="javascript:;">빵</a></li>
							<li><a href="javascript:;">과자</a></li>
							<li><a href="javascript:;">떡</a></li>
							<li><a href="javascript:;">국</a></li>
							<li><a href="javascript:;">밥</a></li>
							<li><a href="javascript:;">술</a></li>
						</ul>
					</div>
					<div class="dream1_cont">
						<ul>
							<li><a href="javascript:;">용</a></li>
							<li><a href="javascript:;">뱀</a></li>
							<li><a href="javascript:;">원숭이</a></li>
							<li><a href="javascript:;">개</a></li>
							<li><a href="javascript:;">말</a></li>
							<li><a href="javascript:;">소</a></li>
							<li><a href="javascript:;">돼지</a></li>
							<li><a href="javascript:;">토끼</a></li>
							<li><a href="javascript:;">쥐</a></li>
							<li><a href="javascript:;">고양이</a></li>
							<li><a href="javascript:;">사자</a></li>
							<li><a href="javascript:;">호랑이</a></li>
							<li><a href="javascript:;">맹수</a></li>
							<li><a href="javascript:;">닭</a></li>
							<li><a href="javascript:;">학</a></li>
							<li><a href="javascript:;">공작새</a></li>
							<li><a href="javascript:;">봉황</a></li>
							<li><a href="javascript:;">독수리</a></li>
							<li><a href="javascript:;">매</a></li>
							<li><a href="javascript:;">물고기</a></li>
						</ul>
					</div>
					<div class="dream1_cont">
						<ul>
							<li><a href="javascript:;">꽃</a></li>
							<li><a href="javascript:;">쌀</a></li>
							<li><a href="javascript:;">보리</a></li>
							<li><a href="javascript:;">콩</a></li>
							<li><a href="javascript:;">씨앗</a></li>
							<li><a href="javascript:;">과일</a></li>
							<li><a href="javascript:;">열매</a></li>
							<li><a href="javascript:;">나무</a></li>
						</ul>
					</div>
					<div class="dream1_cont">
						<ul>
							<li><a href="javascript:;">해</a></li>
							<li><a href="javascript:;">달</a></li>
							<li><a href="javascript:;">하늘</a></li>
							<li><a href="javascript:;">별</a></li>
							<li><a href="javascript:;">산</a></li>
							<li><a href="javascript:;">물</a></li>
							<li><a href="javascript:;">바다</a></li>
							<li><a href="javascript:;">강</a></li>
							<li><a href="javascript:;">호수</a></li>
							<li><a href="javascript:;">불</a></li>
							<li><a href="javascript:;">비</a></li>
							<li><a href="javascript:;">우박</a></li>
							<li><a href="javascript:;">천둥</a></li>
							<li><a href="javascript:;">번개</a></li>
							<li><a href="javascript:;">바람</a></li>
							<li><a href="javascript:;">안개</a></li>
							<li><a href="javascript:;">구름</a></li>
							<li><a href="javascript:;">무지개</a></li>
							<li><a href="javascript:;">지진</a></li>
							<li><a href="javascript:;">홍수</a></li>
							<li><a href="javascript:;">바위</a></li>
						</ul>
					</div>
					<div class="dream1_cont">
						<ul>
							<li><a href="javascript:;">감기</a></li>
							<li><a href="javascript:;">질병</a></li>
							<li><a href="javascript:;">사고</a></li>
							<li><a href="javascript:;">시체</a></li>
							<li><a href="javascript:;">장례</a></li>
						</ul>
					</div>
					<div class="dream1_cont">
						<ul>
							<li><a href="javascript:;">색깔</a></li>
							<li><a href="javascript:;">숫자</a></li>
							<li><a href="javascript:;">전쟁</a></li>
							<li><a href="javascript:;">무기</a></li>
							<li><a href="javascript:;">시간</a></li>
							<li><a href="javascript:;">영화</a></li>
							<li><a href="javascript:;">게임</a></li>
						</ul>
					</div>
				</div><!--top-->
				
				<div class="conts">
					<h4>검색결과</h4>
					<div class="box">
<?	if($contents['F020']['total_count'] > 0) : ?>
						<div class="title">
							&quot;<span class="key"><?=$name1?></span>&quot; 관련 꿈해몽 검색 내용입니다.
						</div><!--title-->
<?	else : ?>
						검색된 결과가 없습니다.
<?	endif ?>
<?	foreach ($contents['F020']['result_list'] as $item) : ?>
						<dl>
							<dt class="result_title"><a href="javascript:;"><?=str_replace($name1, '<span class="key">'.$name1.'</span>', $item['db_title']); ?></a></dt>
							<dd class="result"><?=$item['db_data']?></dd>
						</dl>
<?	endforeach ?>

						<!--페이지 네비게이션-->
                    	<div class="pageNavi">
<?	for($i = 1 ; $i <= $contents['F020']['lastpage']; $i++) : ?>
<?		if ($i == $page) : ?>
                        	<a href="javascript:;" class="over"><?=$i?></a> 
<?		else : ?>
							<a href="javascript:goPage('<?=$i?>')"><?=$i?></a>
<?		endif ?>
<?	endfor ?>
                        </div>
                        <!--//페이지 네비게이션-->
						
					</div><!--box-->
                    
				</div><!--conts-->
				</div><!--box-->
			</div>
			<!--dream1--> 
             
		</div>	
		<!--// Contents -->
          <!--서비스배너-->
        <? include_once $_SERVER['DOCUMENT_ROOT'].'/include/static/bn_service.php'; ?>
        <!--//서비스배너--> 
		</div>
        <!--// 메인컨텐츠-->

	<!-- Footer -->
	<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/main_footer.php'; ?>
	<!--// Footer -->
   
</div>
</body>
</html>